package com.example.shengyin.service;



import com.example.shengyin.dao.TeamMapper;
import com.example.shengyin.entity.Page;
import com.example.shengyin.entity.Team;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class TeamService
{
    @Autowired
    private TeamMapper dao;
    /**
     * 查询team
     * 
     * @param id team主键
     * @return team
     */
    public Team selectById(Long id)
    {
        return dao.selectById(id);
    }



    /**
     * 新增team
     * 
     * @param team team
     * @return 结果
     */
     public int add(Team team)
    {
        return dao.add(team);
    }

    /**
     * 修改team
     * 
     * @param team team
     * @return 结果
     */
    public int update(Team team)
    {
        return dao.update(team);
    }

    /**
     * 批量删除team
     * 
     * @param ids 需要删除的team主键集合
     * @return 结果
     */
    public int delByIds(String ids)
    {
        return dao.delByIds(ids);
    }

    /**
     * 删除team信息
     * 
     * @param id team主键
     * @return 结果
     */
    public int delById(Long id)
    {
        return dao.delById(id);
    }

    public Page selectList(String tname, int pageNo, int pageSize){
        List<Team> list = dao.selectList(tname, pageNo, pageSize);
        int total = dao.find(tname);
        return new Page(list, pageNo, total, pageSize);
    }

    public int find(String tname) {
        return dao.find(tname);
    }

    public List<Team> findAll(){
        List<Team> all = dao.findAll();
        return all;
    }
    public int updateIsvalid(@Param("isvalid")boolean isvalid, @Param("id")Long id){
        return dao.updateIsvalid(isvalid,id);
    }
}
